home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / 1997.ZIP / WINDO28.ARC / WINDO28.DOC < prev    next >
Text File  |  1988-09-30  |  13KB  |  220 lines

  1. Unit Windo28;
  2.  
  3. Interface
  4.  
  5. { ===================================================================== }
  6. {  WINDO - Windowing routines for Turbo PASCAL                          }
  7. {                                                                       }
  8. {     Author:   Michael Burton                                          }
  9. {               15540 Boot Hill Rd.                                     }
  10. {               Hayden Lake, ID 83835                                   }
  11. {               (208) 772-9347 (after 1800 PST)                         }
  12. {     Revision: 2.6                                                     }
  13. {     Date:     16 September 1987                                       }
  14. {                                                                       }
  15. {  Execute the WINTUTOR program for an explanation of use.              }
  16. {                                                                       }
  17. {  This is a 'Shareware' program.  If you find it to be of significant  }
  18. {  use to you, a $10 donation to the above address would be greatly     }
  19. {  appreciated.  This would also place you on our mailing list to keep  }
  20. {  you informed of upgrades to Windo and of new programs.               }
  21. {                                                                       }
  22. { Modifications:                                                        }
  23. { DATE      Rev  Description                                            }
  24. { 04 Mar 86 2.1  Make the heap available check properly                 }
  25. { 02 Jul 86 2.2  Get proper string length in GETDISP and DISPALL        }
  26. { 03 Jul 86 2.3  Change Set_Cursor to properly handle monochrome        }
  27. { 01 Oct 86 2.4  Change Bleep to sound like Oh, Oh.                     }
  28. { 20 Apr 87 2.5  Fix monochrome clrscr's of multiple windows            }
  29. { 21 Sep 87 2.6  Fix lost interrupt problem in inline code              }
  30. {                Add shadow effects to windows                          }
  31. {                Add title positioning to titlewindo                    }
  32. {                Add attribute changes to titlewindo                    }
  33. {                Add a real error sound routine                         }
  34. {                Add an attribute function                              }
  35. { 05 Dec 87 2.7  Convert to a Turbo Pascal 4.0 Unit                     }
  36. { 30 Sep 88 2.8  Recompile for use with Turbo Pascal 5.0                }
  37. { ===================================================================== }
  38.  
  39. Uses Crt, Dos;
  40.  
  41. Type
  42.      windimtype = record
  43.                      colb,rowb,cole,rowe,attrib,bordr,lastx,lasty,shad : byte;
  44.                   end;
  45.      charptr = ^char;
  46.      winstr = string[80];
  47.      brdtype = record
  48.                   ul,ur,ll,lr,hz,vtl,vtr: char;
  49.                end;
  50.  
  51. Const 
  52.      maxwin  = 30;        { Total number of windows on screen at any time }
  53.  
  54. { These constants should be used when defining the border type in a }
  55. { makewindo declaration                                             }
  56.      noneb   = 0;         { No border           }
  57.      singleb = 1;         { Single border       }
  58.      doubleb = 2;         { Double border       }
  59.      mixedb  = 3;         { Mixed border        }
  60.      solidb  = 4;         { Solid border        }
  61.      dimondb = 5;         { Diamond border      }
  62.      circleb = 6;         { Circles border      }
  63.      lhatchb = 7;         { light hatch border  }
  64.      mhatchb = 8;         { medium hatch border }
  65.      dhatchb = 9;         { dense hatch border  }
  66.  
  67. { These constants should be used when defining a shadow for a window }
  68. { in a makewindo declaration                                         }
  69.      nones  = 0;           { no shadow           }
  70.      lefts  = 1;           { shadow to the left  }
  71.      rights = 2;           { shadow to the right }
  72.  
  73. { These constants should be used when defining the position of a title }
  74. { in a titlewindo declaration                                          }
  75.      centert = 0;          { center top title    }
  76.      leftt   = 1;          { left top title      }
  77.      rightt  = 2;          { right top title     }
  78.      centerb = 3;          { center bottom title }
  79.      leftb   = 4;          { left bottom title   }
  80.      rightb  = 5;          { right bottom title  }
  81.  
  82.  
  83.       brd: array[1..9] of brdtype =  (
  84.           (ul:'┌';ur:'┐';ll:'└';lr:'┘';hz:'─';vtl:'│';vtr:'│'),  { single }
  85.           (ul:'╔';ur:'╗';ll:'╚';lr:'╝';hz:'═';vtl:'║';vtr:'║'),  { double }
  86.           (ul:'╒';ur:'╕';ll:'╘';lr:'╛';hz:'═';vtl:'│';vtr:'│'),  { mixed  }
  87.           (ul:'█';ur:'█';ll:'█';lr:'█';hz:'█';vtl:'▌';vtr:'▐'),  { solid  }
  88.           (ul:' ';ur:' ';ll:' ';lr:' ';hz:' ';vtl:' ';vtr:' '),  { diamond}
  89.           (ul:' ';ur:' ';ll:' ';lr:' ';hz:' ';vtl:' ';vtr:' '),  { circle }
  90.           (ul:'░';ur:'░';ll:'░';lr:'░';hz:'░';vtl:'░';vtr:'░'),  { lhatch }
  91.           (ul:'▒';ur:'▒';ll:'▒';lr:'▒';hz:'▒';vtl:'▒';vtr:'▒'),  { mhatch }
  92.           (ul:'▓';ur:'▓';ll:'▓';lr:'▓';hz:'▓';vtl:'▓';vtr:'▓')); { dhatch }
  93.  
  94. var
  95.      wndo    : Array [0..maxwin] of windimtype; { window attributes      }
  96.      wndoptr : Array [1..maxwin] of charptr; { pointer to window on heap }
  97.      tmpptr  : charptr;                      { temporary pointer         }
  98.      l_i  : byte;                            { level index               }
  99.      wndostr : winstr;                       { string for building wndos }
  100.  
  101. { ===================================================================== }
  102. { GETDISP - Get an array of characters from the CRT display and store   }
  103. {           them in tostrng.                                            }
  104. {           The row and column inputs are relative to zero and are      }
  105. {           also relative to the entire screen, not any open window.    }
  106. {                                                                       }
  107. {    Inputs:                                                            }
  108. {       colb      : byte;    Starting column (0 - 79)                   }
  109. {       rowb      : byte;    Starting row    (0 - 24)                   }
  110. {       len       : byte;    length of array                            }
  111. {       tostrng   : charptr; Pointer to character storage               }
  112. { ===================================================================== }
  113. Procedure GetDisp(colb,rowb,len : byte; tostrng : charptr);
  114.  
  115. { ===================================================================== }
  116. { DISPALL - Display an array of characters and attributes on the CRT.   }
  117. {           The array is usually one that has been created using the    }
  118. {           GetDisp procedure.                                          }
  119. {           The row and column inputs are relative to zero and are      }
  120. {           also relative to the entire screen, not any open window.    }
  121. {                                                                       }
  122. {    Inputs:                                                            }
  123. {       colb      : byte;    Starting column  (0 - 79)                  }
  124. {       rowb      : byte;    Starting row     (0 - 24)                  }
  125. {       len       : byte;    length of array  (not including attributes)}
  126. {       fromstrng : charptr; Pointer to array to display                }
  127. { ===================================================================== }
  128. Procedure DispAll(colb,rowb,len : byte; fromstrng : charptr);
  129.  
  130. { ===================================================================== }
  131. { DISPLINE - Display a string of characters on the CRT (with the same   }
  132. {            attributes)                                                }
  133. {           The row and column inputs are relative to zero and are      }
  134. {           also relative to the entire screen, not any open window.    }
  135. {                                                                       }
  136. {    Inputs:                                                            }
  137. {       colb      : byte;       Starting column  (0 - 79)               }
  138. {       rowb      : byte;       Starting row     (0 - 24)               }
  139. {       attrib    : byte;       Line attributes                         }
  140. {       fromstrng : winstr;     String to display                       }
  141. { ===================================================================== }
  142. Procedure DispLine(colb,rowb,attrib : byte; VAR fromstrng : winstr);
  143.  
  144. { ======================================================================== }
  145. { Bleep - Produce a bleeping sound times number of times                   }
  146. {                                                                          }
  147. { Inputs: times : byte;  The number of bleeps required                     }
  148. { ======================================================================== }
  149. Procedure Bleep(times : byte);
  150.  
  151. { ======================================================================== }
  152. { ErrorSound - Produce an error sound                                      }
  153. { ======================================================================== }
  154. Procedure ErrorSound;
  155.  
  156. { ======================================================================== }
  157. { Wattr - Return a combined attributes byte                                }
  158. { ======================================================================== }
  159. Function Wattr(text,backgnd: byte): byte;
  160.  
  161. { ======================================================================== }
  162. { Set_Cursor - Set the cursor size                                         }
  163. { Inputs: The number of cursor lines to display (0 -7, 0-14)               }
  164. { ======================================================================== }
  165. Procedure Set_Cursor (n: byte);
  166.  
  167. { ===================================================================== }
  168. { INITWINDO - Initialize the window variables                           }
  169. {                                                                       }
  170. { Use this routine before using MAKEWINDO, REMOVEWINDO or TITLEWINDO    }
  171. {                                                                       }
  172. {    Inputs:                                                            }
  173. {       txtcolor  : byte;    Starting text color                        }
  174. {       bkgndclr  : byte;    Starting background color                  }
  175. { ===================================================================== }
  176. Procedure InitWindo(txtcolor,bkgndclr : byte);
  177.  
  178. { ===================================================================== }
  179. { MAKEWINDO - Create a window                                           }
  180. {                                                                       }
  181. {    Inputs:                                                            }
  182. {         colb     : byte;   Start column     (1 - 80)                  }
  183. {         rowb     : byte;   Start row        (1 - 25)                  }
  184. {         cole     : byte;   End column       (1 - 80)                  }
  185. {         rowe     : byte;   End row          (1 - 25)                  }
  186. {         tcolor   : byte;   Text color       (0 - 15)                  }
  187. {         tback    : byte;   Text background  (0 - 7, > 7 for blinking) }
  188. {         bordr    : byte;   Border indicator (0 - 9)                   }
  189. {         shadoweffect : byte; The window's shadow (0 - 2)              }
  190. { ===================================================================== }
  191. Procedure MakeWindo(colb,
  192.                     rowb,
  193.                     cole,
  194.                     rowe,
  195.                     tcolor,
  196.                     tback,
  197.                     bordr,
  198.                     shadoweffect : byte);
  199.  
  200. { ===================================================================== }
  201. { REMOVEWINDO - Remove the last window created from the screen.  To     }
  202. {               get back to the original screen, there must be as many  }
  203. {               Removewindos as there are Makewindos.                   }
  204. {                                                                       }
  205. {    Inputs:                                                            }
  206. {         None                                                          }
  207. { ===================================================================== }
  208. Procedure RemoveWindo;
  209.  
  210. { ===================================================================== }
  211. { TITLEWINDO - Place a centered title in the top border of a window.    }
  212. {                                                                       }
  213. {    Inputs:                                                            }
  214. {         title   : winstr;     The title of the window                 }
  215. {         position: byte;       Where to put the title                  }
  216. {         attr    : byte;       What colors to make the title           }
  217. { ===================================================================== }
  218. Procedure TitleWindo (title: winstr; position, attr: byte);
  219.  
  220.